﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Windows;
using System.Threading;
using System.Windows.Forms;

namespace QuickUIT.TestApplication
{
    /// <summary>
    /// Interaction logic for MainWindow.xaml
    /// </summary>
    public partial class MainWindow : Window
    {
        public MainWindow()
        {
            InitializeComponent();
        }

        private void Window_Loaded(object sender, RoutedEventArgs e)
        {
            dataGrid1.ItemsSource = GenerateDataGridSampleData();
            comboBox2.ItemsSource = GenerateComboBoxSampleData();

            var numericUpDown = new NumericUpDown {Minimum = 0, Maximum = 5};
            windowsFormsHost1.Child = numericUpDown; 
        }

        private IEnumerable<int> GenerateComboBoxSampleData()
        {
            List<int> data = new List<int>();
            return Enumerable.Range(0, 100); 
        }

        private List<SampleData> GenerateDataGridSampleData()
        {
            List<SampleData> data = new List<SampleData>();
            data.Add(new SampleData
            {
                ID = 101,
                Name = "Test1",
                Date = new DateTime(1998, 1, 15),
                Enable = true
            });
            data.Add(new SampleData
            {
                ID = 102,
                Name = "Test2",
                Date = new DateTime(1999, 3, 1),
                Enable = false
            });
            data.Add(new SampleData
            {
                ID = 103,
                Name = "Test3",
                Date = new DateTime(2000, 5, 3),
                Enable = true
            });
            data.Add(new SampleData
            {
                ID = 104,
                Name = "Test4",
                Date = new DateTime(1995, 5, 10),
                Enable = true
            });
            data.Add(new SampleData
            {
                ID = 105,
                Name = "Test5",
                Date = new DateTime(1990, 6, 21),
                Enable = true
            });
            return data; 
        }

        private void button2_Click(object sender, RoutedEventArgs e)
        {
            AboutWindow aboutWindow = new AboutWindow();
            aboutWindow.ShowDialog(); 
        }

        private void button3_Click(object sender, RoutedEventArgs e)
        {
            Thread.Sleep(2000);
            SlowWindow slowWindow = new SlowWindow();
            slowWindow.Show(); 
        }

        private void button4_Click(object sender, RoutedEventArgs e)
        {
            TestWindow testWindow = new TestWindow();
            testWindow.Show();
        }
    }
}
